package org.springblade.third.provider;

import org.springblade.third.dto.ThirdRequest;
import org.springblade.third.dto.ThirdResponse;
import org.springblade.third.spi.ChannelProvider;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class MockChannelProvider implements ChannelProvider {

    @Override
    public boolean supports(String channelCode, String productCode) {
        return "MOCK".equalsIgnoreCase(channelCode);
    }

    @Override
    public ThirdResponse<Object> execute(ThirdRequest request) {
        Map<String, Object> payload = new HashMap<>();
        payload.put("echo", request.getParameters());
        payload.put("bizId", request.getBizId());
        payload.put("product", request.getProductCode());
        return ThirdResponse.ok(payload);
    }
}



